package com.km.noh.weatherinfo.data;       

import org.w3c.dom.Element;

import com.km.noh.weatherinfo.async.WeatherDataAsync;
import com.km.noh.weatherinfo.util.KMStringUtil;
import com.km.noh.weatherinfo.util.Util;


/*
 * FAQ Information class
 */	 
public class WeatherInfo {

    private String dayOfWeek;
    private String tempLow;//최저온도
    private String tempHigh;//최고온도 
    private String tempFahrenheit; //화씨 
	private String tempCelsius;//섭씨 
    private String iconUrl;
    private String condition;
    private String windCondition;
    private String humidity;
    private String forecastDate;
    private String postalCode;
    private String city;
    private static WeatherInfo info;
    
    public static final String TAG_FORECAST_CONDITIONS ="forecast_conditions";
    
    public static final String TAG_CITY ="city";
    public static final String TAG_POSTAL_CODE ="postal_code";
    public static final String TAG_FORECAST_DATE ="forecast_date";
    public static final String TAG_CONDITION ="condition";
    public static final String TAG_HUMIDITY ="humidity";
    public static final String TAG_ICON ="icon";
    public static final String TAG_WIND_CONDITION ="wind_condition";
    public static final String TAG_DAY_OF_WEEK ="day_of_week";
    public static final String TAG_TEMPLOW ="low";
    public static final String TAG_TEMPHIGH ="high";
    public static final String TAG_TEMP_F ="temp_f";
    public static final String TAG_TEMP_C ="temp_c";
	
    public String getDayOfWeek() {
		return dayOfWeek;
	}

	public void setDayOfWeek(String dayOfWeek) {
		this.dayOfWeek = dayOfWeek;
	}

	public String getTempLow() {
		return tempLow;
	}

	public void setTempLow(String tempLow) {
		this.tempLow = tempLow;
	}

	public String getTempHigh() {
		return tempHigh;
	}

	public void setTempHigh(String tempHigh) {
		this.tempHigh = tempHigh;
	}

	public String getIconUrl() {
		return KMStringUtil.getStr(iconUrl).equals("")?"":WeatherDataAsync.googleDomain+iconUrl;
	}

	public void setIconUrl(String iconUrl) {
		this.iconUrl = iconUrl;
	}

	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public String getWindCondition() {
		return windCondition;
	}

	public void setWindCondition(String windCondition) {
		this.windCondition = windCondition;
	}

	public String getHumidity() {
		return humidity;
	}

	public void setHumidity(String humidity) {
		this.humidity = humidity;
	}

	public String getForecastDate() {
		return forecastDate;
	}

	public void setForecastDate(String forecastDate) {
		this.forecastDate = forecastDate;
	}

	public String getPostalCode() {
		return postalCode;
	}

	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		Util.log("setCity===>>"+city);
		this.city = city;
	}

    public String getTempFahrenheit() {
		return tempFahrenheit;
	}

	public void setTempFahrenheit(String tempFahrenheit) {
		this.tempFahrenheit = tempFahrenheit;
	}

	public String getTempCelsius() {
		return tempCelsius;
	}

	public void setTempCelsius(String tempCelsius) {
		this.tempCelsius = tempCelsius;
	}
	public static WeatherInfo getInfo() {
		return info;
	}

	public static void setInfo(WeatherInfo info) {
		WeatherInfo.info = info;
	}

	public WeatherInfo() {
	}
	
	public WeatherInfo(Element e, String parent, int i) {
		
		try {
			setCity(Util.parseXmlDocument(e,parent, TAG_CITY, i));
			setPostalCode(Util.parseXmlDocument(e,parent, TAG_POSTAL_CODE, i));
			setForecastDate(Util.parseXmlDocument(e,parent, TAG_FORECAST_DATE, i));
			setCondition(Util.parseXmlDocument(e,parent, TAG_CONDITION, i));
			setHumidity(Util.parseXmlDocument(e,parent, TAG_HUMIDITY, i));
			setIconUrl(Util.parseXmlDocument(e,parent, TAG_ICON, i));
			setWindCondition(Util.parseXmlDocument(e,parent, TAG_WIND_CONDITION, i));
			setDayOfWeek(Util.parseXmlDocument(e,parent, TAG_DAY_OF_WEEK, i));
			setTempLow(Util.parseXmlDocument(e,parent, TAG_TEMPLOW, i));
			setTempHigh(Util.parseXmlDocument(e,parent, TAG_TEMPHIGH, i));
			setTempCelsius(Util.parseXmlDocument(e,parent, TAG_TEMP_C, i));
			setTempFahrenheit(Util.parseXmlDocument(e,parent, TAG_TEMP_F, i));
		}catch (Exception ex) {
			Util.logError(ex);
		}
	}
	
	public static WeatherInfo getLoginInfo(){
		return info;
	}
	
	public static void setLoginInfo(WeatherInfo loginInfo){
		info = loginInfo;
	}
	
	
}